﻿using Microsoft.AspNetCore.Mvc.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace SceneEvidenceAPI.Filters
{
    /// <summary>
    /// 异常处理，记录日志，返回异常类型和信息
    /// </summary>
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
    public class ExceptionAttribute : Attribute, IExceptionFilter
    {
        /// <summary>
        /// 异常处理
        /// </summary>
        /// <param name="context"></param>
        public void OnException(ExceptionContext context)
        {

        }
        /// <summary>
        /// 是否为过滤忽略的URL
        /// </summary>
        private static bool IsFilterUrl(string url)
        {
            var urlFilters = new List<string>();
            return urlFilters.Contains(url.ToUpper());
        }
    }
}
